/**
 * New node file
 */

var COLLECTION_PRODUCT = "product";

var db = require("./connectionDB");
db.connect();


function addProduct(product, callback){
	
	db.collection(COLLECTION_PRODUCT, function(error, collection){
	
		/**INSERT**/
		collection.insert(product, {safe:true}, function(error, result){
			
			if(error){
				callback({success:false});
			}
			else{
				callback({success:true,product:result[0]});
			}
		});	
	}); 
}

